package com.xiaocg.jee.controller;

import com.xiaocg.jee.model.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope
public class TestNacosConfigController {

    @Value("${ipAddress}")
    private String ipAddress;

    @Autowired
    private UserInfo userInfo;

    @GetMapping("/ipAddress")
    public String now(){
        return ipAddress+"-----"+userInfo.toString();
    }

    @GetMapping("/user/{id}")
    public String testFeign(@PathVariable("id") Long id){
        return "测试成功:"+id;
    }
}
